<?php
	@session_start();
	include("../../connect/connect_mysql.php");
	
function redirect($path){
    header("Location: $path");
}  
	$page= $_POST["group"];
	$date= $_POST["date"];
	$info = $_POST["info"];
//	$info = str_replace('\n', '.-', $_POST["info"]);
	$info=eregi_replace(chr(13),"",$info);
	$info=str_replace("\n",".-",$info);
	$query = "SELECT * FROM page WHERE name = '$page'";
	$rs= mysql_query($query);
	
	if($rs){
		while ($row = mysql_fetch_array($rs, MYSQL_NUM)) {
			$id =$row[0];
		}
	}
	mysql_query ("SET NAMES 'utf8'");
	mysql_query("INSERT INTO `content` (`page_id`, `date`,`info`, `flag`, `is_deleted`) VALUES ('$id','$date','$info','0','0');");
	redirect('/wheelhouse/admin/');
?>